package net.lijingye.education.vo;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import net.lijingye.education.entity.Visitor;
import net.lijingye.education.util.CommonUtil;

import java.util.Date;

/**
 * Created by LijingYe on 2016/3/26.
 */
public class VisitorVO {
    @JSONField(name = "id", ordinal = 0, serialzeFeatures = SerializerFeature.WriteMapNullValue)
    private String id;
    @JSONField(name = "name", ordinal = 1, serialzeFeatures = SerializerFeature.WriteMapNullValue)
    private String name;
    @JSONField(name = "faceIcon", ordinal = 2, serialzeFeatures = SerializerFeature.WriteMapNullValue)
    private String faceIcon;
    @JSONField(name = "time", ordinal = 3, serialzeFeatures = SerializerFeature.WriteMapNullValue, format = "yyyy/MM/dd HH:mm")
    private Date time;

    public VisitorVO(Visitor visitor) {
        this.id = visitor.getVisitor().getId();
        this.name = CommonUtil.getUserDisplayName(visitor.getVisitor());
        this.faceIcon = visitor.getVisitor().getFaceIcon();
        this.time = visitor.getTime();
    }

    public VisitorVO(String id, String name, String faceIcon, Date time) {
        this.id = id;
        this.name = name;
        this.faceIcon = faceIcon;
        this.time = time;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getFaceIcon() {
        return faceIcon;
    }

    public void setFaceIcon(String faceIcon) {
        this.faceIcon = faceIcon;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    @Override
    public String toString() {
        return "VisitorVO{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", faceIcon='" + faceIcon + '\'' +
                ", time=" + time +
                '}';
    }
}
